<?php
namespace Project_725;

use TwinPeaks\Core as Core;

class FC_ApiExcep extends Core\CBaseException
{
	const INVALID_TOKEN = 1;
	const NO_PAIRED_USER = 2;
	const ACCOUNT_SUSPENDED = 3;
	const PAIRED_UNKNOWN_LOCATION = 4;
	const ACCOUNT_EXISTS = 5;
	const WRONG_CREDENTIALS = 6;
	
	/**
	 * @return FC_ApiExcep
	 */
	static function invalidAccessToken($token)
	{
		return new static(sprintf('Invalid access token %s', $token),
			self::INVALID_TOKEN);
	}
	
	/**
	 * @return FC_ApiExcep
	 */
	static function noPairedUser()
	{
		return new static('No paired user', self::NO_PAIRED_USER);
	}
	
	/**
	 * @return FC_ApiExcep
	 */
	static function accountSuspended()
	{
		return new static('Account has been suspended', self::ACCOUNT_SUSPENDED);
	}
	
	/**
	 * @return FC_ApiExcep
	 */
	static function pairedUnknownLoc()
	{
		return new static('Location of the paired user is unknown',
			self::PAIRED_UNKNOWN_LOCATION);
	}
	
	/**
	 * @return FC_ApiExcep
	 */
	static function accountExists($loginName)
	{
		return new static(sprintf('A user account with login name %s does exist', $loginName),
			self::ACCOUNT_EXISTS);
	}
	
	/**
	 * @return FC_ApiExcep
	 */
	static function wrongCredentials()
	{
		return new static('Wrong credentials', self::WRONG_CREDENTIALS);
	}
}
